#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
Introduction to Programming in Java - An Interdisciplinary Approach

All book programs ported to Python solely by
Scott C. King (revisionx at {gee}ma1l <dot> c0m).

All program examples pass Pylint with a perfect 10.00 score.
Pylint:  http://www.pylint.org/


Program 1.3.3 - Computing powers of two

Syntax:
python powersoftwo.py 10


Notes:
sys is a required import here in order to use command line arguments.
https://docs.python.org/2/tutorial/stdlib.html

int(sys.argv[x]) == Integer.parseInt(args[x])

'''

import sys


def main():
    ''' Compute the powers of two to a user-defined exponent '''

    power = int(sys.argv[1])
    current_power = 1
    counter = 0
    while counter <= power:
        print "{} {}".format(counter, current_power)
        current_power = 2 * current_power
        counter += 1

if __name__ == '__main__':
    main()
